#include "PageManager.h"
#include "TimePage.h"
#include "CurrentVoltagePage.h"
#include "SystemIdPage.h"
#include "OnlineExtendDevices.h"
#include "PowerPage.h"
#include "OfflineCommandPage.h"
#include "NetworkManagePage.h"
#include "InteractionCommandPage.h"
#include "DoorStatusPage.h"
#include "LoopStatusControlPage.h"
#include "VideoControllerPage.h"
#include "NetEnvConfigPage.h"
#include "LoopControllerConfigPage.h"
#include "TimedComandConfigPage.h"
#include "PasswordPage.h"
#include "LuxInfoPage.h"
#include "GpsInfoPage.h"
#include "TemperatureInfoPage.h"
#include "DoorAcSwitchStatusPage.h"

PageManager::PageManager():guiContext(GuiContextSingleton::instance()) {
    initPage();
    guiContext.setPage(0);
}


void PageManager::initPage() {

    std::vector<BasePageSharedPtr>& pageList = guiContext.pageList;

    BasePage* pPage = new TimePage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));//1

    pPage = new SystemIdPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));//2

    pPage = new NetworkManagePage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));//3

    pPage = new OnlineExtendDevices(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //4

    pPage = new LoopControllerConfigPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //5

    pPage = new InteractionCommandPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));//6

    pPage = new OfflineCommandPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //7

    pPage = new OfflineCommandPage(pageList.size() + 1, "willExecute:", 1, 0);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //8

    pPage = new TimedComandConfigPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //9

    guiContext.pLoopStatusControlPage = new LoopStatusControlPage(pageList.size() + 1);
    pPage = guiContext.pLoopStatusControlPage;
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //10

    pPage = new VideoControllerPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //11

    pPage = new PowerPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //11

    pPage = new CurrentVoltagePage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //13

    pPage = new DoorStatusPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                   //14

    pPage = new NetEnvConfigPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //15

    pPage = new LuxInfoPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //16

    pPage = new GpsInfoPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //17

    pPage = new TemperatureInfoPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //18

    pPage = new DoorAcSwitchStatusPage(pageList.size() + 1);
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));

    guiContext.pPasswordPage = new PasswordPage(pageList.size() + 1);
    pPage = guiContext.pPasswordPage;
    pPage->initialize();
    pageList.push_back(BasePageSharedPtr(pPage));                     //19


}










